import Ember from 'ember';
import config from 'game-front/config/environment';
import RSVP from 'rsvp';

export default Ember.Route.extend({
  beforeModel: function(posts, transition) {
    Ember.run.scheduleOnce('afterRender', this, function() {
      Ember.$(".user-background").height(document.body.scrollHeight);
    });
  },
  model(params) {
    var userInfo = this.modelFor("application");
    console.log(userInfo);
    return RSVP.hash({
      rankings:Ember.$.getJSON(config.apiBase + "rankings/last", {userId:userInfo ? userInfo.userId : 'none', gameZoneProductId:1}),
      userInfo: Ember.$.getJSON(config.apiBase + "members", {userId:params.key}),
      qrInfo:Ember.$.getJSON(config.apiBase + "share/qr", {userId:params.key})
    });
  },
  actions: {
      home:function(){
        Ember.$(".shade").css({"display":"block"});
        Ember.$(".shade-gameshare").css({"display":"block"});
      },
      homeTo:function(){
        Ember.$(".shade").css({"display":"none"});
        Ember.$(".shade-gameshare").css({"display":"none"});
      },
    showShare() {
      console.log("adfd");
      $(".shade-share").css({"display":"block"});
    },
    hidder(){
      $(".shade-share").css({"display":"none"});
    }
  }
});
